home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / os2 / irit40e1.zip / IRITINIT.IRT < prev    next >
Text File  |  1994-01-04  |  2KB  |  67 lines

  1. echosrc = false;
  2.  
  3. demo = procedure():
  4.     include("demo.irt");
  5.  
  6. #
  7. # Some simple functions.
  8. #
  9. min = function(x, y):
  10.     if (x > y, return = y, return = x);
  11. max = function(x, y):
  12.     if (x > y, return = x, return = y);
  13. sqr = function(x):
  14.     return = x * x;
  15. normalize = function(x):len:
  16.     return = 1.0:
  17.     if (thisobj(x) == vector_type,
  18.     len = sqrt(x * x):
  19.     return = vector(coord(x, 0) / len,
  20.             coord(x, 1) / len,
  21.             coord(x, 2) / len)):
  22.     if (thisobj(x) == point_type,
  23.     len = sqrt(x * x):
  24.     return = point(coord(x, 0) / len,
  25.                coord(x, 1) / len,
  26.                coord(x, 2) / len)):
  27.     if (thisobj(return) == numeric_type,
  28.     printf("NORMALIZE: Can handle only vectors or points, found %8.6lDg\n",
  29.            list(x)));
  30.  
  31. #
  32. # Emulation of view, interact and other useful viewing functions using VIEWOBJ
  33. #
  34. viewclear = procedure():command_: # Clear the screen.
  35.     command_ = "CLEAR":
  36.     viewobj(command_);
  37. viewdclear = procedure():command_: # Delayed clear screen.
  38.     command_ = "DCLEAR":
  39.     viewobj(command_);
  40. viewdisc = procedure():command_: # Disconnect from this display device
  41.     command_ = "DISCONNECT":
  42.     viewobj(command_);
  43. viewexit = procedure():command_: # Force Display device to exit.
  44.     command_ = "EXIT":
  45.     viewobj(command_);
  46. viewsave = procedure(name):command_: # Save viewing matrix under name.
  47.     command_ = "MSAVE " + name:
  48.     viewobj(command_);
  49. viewremove = procedure(name):command_: # Remove an object from display.
  50.     command_ = "REMOVE " + name:
  51.     viewobj(command_);
  52. beep = procedure():command_: # Make some noise.
  53.     command_ = "BEEP":
  54.     viewobj(command_);
  55. viewstate = procedure(state):command_: # Change state of display device.
  56.     command_ = "STATE " + state:
  57.     viewobj(command_);
  58. view = procedure(none,clear): # Emulation of old VIEW command.
  59.     if (clear != 0.0, viewdclear()):
  60.     viewobj(none);
  61. interact = procedure(none): # Emulation of old INTERACT command.
  62.     viewdclear():
  63.     viewobj(none):
  64.     pause(1);
  65.  
  66. echosrc = true;
  67.